<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
<script>
    {//``与这个${}连用
    let name="超哥";
    let age=32;
    console.log(`我叫${name},今年${age}`);
    }
    var str="我爱143yyds333";
    console.log(str.includes("3"));
    str.startsWith("我");
    str.endsWith("4");
    console.log(str.repeat("3"));
    //arrays ...吧数组变为序列
let arr1=[1,2,3];
arr1.push(...[12,22,33,44,55]);
arr1.forEach(xjj=>console.log(xjj));
//复制数组
let arr2=[1,2,3];
let arr3=arr2.concat();
arr3.forEach(xjj=>console.log(xjj));
//合并
arr2.concat(arr3).forEach(xjj=>console.log(xjj));
//解构赋值
  const[first,...rest]=[1,2,3,4,5,6,9];
//.from() 类数组变成真数组--必须有一个length
let dx={name:"超哥",age:32,hobby:"拿刀砍女仁",length:3};
let arr5=Array.from(dx);
console.log(arr5);
arr5.forEach(xjj=>console.log(xjj));
//键值对
let arr6=["乐乐","朱朱","蝴蝶","超哥的大砍刀"];
for(let index of arr6.keys() ){//k
    console.log("坐标:"+index);
}
for(let v of arr6.values() ){//k
    console.log("值:"+v);
}
for(let [index,v] of arr6.entries() ){//k-v
    console.log("k-v:"+[index,v]);
}
//对象es6
let name1="超哥";
let age1=32;
let dx1={
    name1,age1,
    showInfo(){
        console.log(`我叫${name1},今年${age1}`);//反引号拿值
    }
}
dx1.showInfo();
//对象合并
let dx2={a:1};let dx3={b:2};let dx4={c:3};
Object.assign(dx2,dx3,dx4);//第一个来装后2个
console.log(dx2);
//对象遍历
var dx5={name:"cc",age:32};
console.log("k:"+Object.keys(dx5));
console.log("v:"+Object.values(dx5));
console.log("k-v:"+Object.entries(dx5));
//set 合并去重
let arr11 = [1, 2, 3];
let arr22 = [2, 3, 4, 5];
let set2 = new Set([...arr11, ...arr22])
console.log(set2);
let s1=new Set();
s1.add(1);
s1.add(2);
s1.delete(1);
console.log("s1的长度"+s1.size);
console.log(s1.has(1));
s1.clear();
console.log("s1的长度"+s1.size);
let s2=new Set([{name:"乐乐"},{name:"朱朱"}]);
for(let k of s2.keys()){
    console.log(k);
}
for(let v of s2.values()){
    console.log(v);
}
for(let kv of s2.entries()){
    console.log(kv);
}
//map
let map1=new Map();
map1.set("name","朱朱");
console.log(map1.get('name'));


</script>




</body>
</html>